home *** CD-ROM | disk | FTP | other *** search
- ;GetSel.ASM
- ;Copyright (c) 1992 Jay Munro
- ;First Published in PC Magazine June 16, 1992
- ;Syntax
- ; Declare Function GetAbs%(Byval Segment%)
- ; GoodSelector% = GetAbs%(&hB000)
- ;---------------------------------------------------------------------------
- ; GetAbs.ASM takes an incoming segment value and replaces it with
- ; a Windows compatible selector if it matches one of the 9 possible exported
- ; values. If the value doesn't match it is checked to see if it is a valid
- ; selector, first a writeable one, then a readable one. In the event it
- ; fails all the tests, a -1 is returned otherwise the original value or the
- ; substituted selector is returned.
- ;----------------------------------------------------------------------------
- ;Add these imports (notably __B000 to your module .DEF file).
- ;IMPORTS
- ; LOCALINIT = KERNEL.4
- ; LSTRLEN = KERNEL.90
- ; ALLOCCSTODSALIAS = KERNEL.170
- ; FREESELECTOR = KERNEL.176
- ; UNLOCKSEGMENT = KERNEL.24
- ; SETERRORMODE = KERNEL.107
- ; __0000H = KERNEL.183
- ; __0040H = KERNEL.193
- ; __A000H = KERNEL.174
- ; __B000H = KERNEL.181
- ; __B800H = KERNEL.182
- ; __C000H = KERNEL.195
- ; __D000H = KERNEL.179
- ; __E000H = KERNEL.190
- ; __F000H = KERNEL.194
-
- .286P ;protected instructions below
-
- .Model Small
-
- Public _GETSEL
- ; Include Labnotes.inc
-
- ; Extrn __0000H :ABS
- ; Extrn __0040H :ABS
- ; Extrn __A000H :ABS
- Extrn __B000H :ABS
- ; Extrn __B800H :ABS
- ; Extrn __C000H :ABS
- ; Extrn __D000H :ABS
- ; Extrn __E000H :ABS
- ; Extrn __F000H :ABS
-
- .Code
-
- _GETSEL Proc Near
- Mov AX,__B000h ;get selector
- ; Mov AX,0FFFFh ;get selector
- ret
- _GETSEL EndP
- End
-
-
-
-
-
-